package com.kabu.guardedsuspension;

/**
 * @author jiawuwei
 * @Copyright: Copyright (c) 兆日科技股份有限公司  2020
 * @date 2020/7/22,11:06
 */
public class Consumer {
    private String name;

    public String getName() {
        return name;
    }

    public Consumer setName(String name) {
        this.name = name;
        return this;
    }
    //处理浏览器发来的请求
    Message handleWebReq(){
        int id=1;
        //创建一消息
        Message msg1 = new Message(id,"{...}");
        //创建GuardedObject实例
        GuardedObject<Message> go= GuardedObject.create(id);
        //发送消息
        Mq mq = new Mq();
        mq.send(msg1);
        //等待MQ消息
        Message r = go.get(t->t != null);
        return r;
    }
}
